package com.intelligent.ispc.utils;

/**
 * Created by julia on 16/5/7.
 */
public enum CheckType {

    ALL(1, "ALL"),
    CHECK(2, "CHECK"),
    UNCHECK(3, "UNCHECK");

    private int index;
    private String code;

    CheckType(int index, String code) {
        this.code = code;
        this.index = index;
    }

    public static CheckType getValueOf(String code) {
        if (ALL.getCode().equals(code)) {
            return ALL;
        } else if (CHECK.getCode().equals(code)) {
            return CHECK;
        } else if (UNCHECK.getCode().equals(code)) {
            return UNCHECK;
        } else {
            return null;
        }
    }

    public static CheckType getValueOf(int index) {
        switch (index) {
            case 1:
                return ALL;
            case 2:
                return CHECK;
            case 3:
                return UNCHECK;
            default:
                return null;
        }
    }

    public String getCode() {
        return code;
    }

    public int getIndex() {
        return index;
    }
}
